var prefix = ctx + "module/order"

$(function() {
	var columns = [{
            checkbox: true
        },
				{
			field : 'orderId', 
			title : '序号' 
		},
				{
			field : 'orderNum', 
			title : '订单号' 
		},
				{
			field : 'typeName', 
			title : '订单类型' 
		},
				{
			field : 'customerClue.customerName', 
			title : '客户' 
		},
				{
			field : 'customerClue.customerCellphone', 
			title : '手机号码' 
		},
				{
			field : 'serviceUserName', 
			title : '跟进客服' 
		},
				{
			field : 'createTime', 
			title : '创建时间' 
		},
				{
			field : 'finalTime', 
			title : '流单时间' 
		},
				{
			field : 'orderStatus', 
			title : '订单状态',
			formatter: function(value, row, index) {
                if (value == 7) {
                	return '<span class="label label-success">流单</span>';
                }
            }
		},
		        {
            title: '操作',
            align: 'center',
            formatter: function(value, row, index) {
            	var actions = [];
				actions.push('<a class="btn btn-warning btn-sm " href="#" title="详情" mce_href="#" onclick="orderDetail(\'' + row.orderId + '\')"><i class="fa fa-search"></i></a> ');
				return actions.join('');
            }
        }];
	var url = prefix + "/flowList";
	$.initTable(columns, url);
});

//查看流单详情
function orderDetail(orderId) {
    var url = prefix + '/orderDetail/' + orderId;
    layer_showAuto("订单详情", url);
}
